package frontend.lexer.token;

import java.util.HashMap;
import java.util.Map;

public enum TokenType {
    IDENFR,
    INTCON,
    STRCON,
    MAINTK,
    CONSTTK,
    INTTK,
    BREAKTK,
    CONTINUETK,
    IFTK,
    ELSETK,
    NOT,
    AND,
    OR,
    FORTK,
    GETINTTK,
    PRINTFTK,
    RETURNTK,
    PLUS,
    MINU,
    VOIDTK,
    MULT,
    DIV,
    MOD,
    LSS,
    LEQ,
    GRE,
    GEQ,
    EQL,
    NEQ,
    ASSIGN,
    SEMICN,
    COMMA,
    LPARENT,
    RPARENT,
    LBRACK,
    RBRACK,
    LBRACE,
    RBRACE;

    public static final Map<String, TokenType> reservedWord = new HashMap<>() {{
        put("main", MAINTK);
        put("const", CONSTTK);
        put("int", INTTK);
        put("break", BREAKTK);
        put("continue", CONTINUETK);
        put("if", IFTK);
        put("else", ELSETK);
        put("for", FORTK);
        put("getint", GETINTTK);
        put("printf", PRINTFTK);
        put("return", RETURNTK);
        put("void", VOIDTK);
    }};

    public static final Map<String, TokenType> delimiter = new HashMap<>() {{
        put("!", NOT);
        put("&&", AND);
        put("||", OR);
        put("+", PLUS);
        put("-", MINU);
        put("*", MULT);
        put("/", DIV);
        put("%", MOD);
        put("<", LSS);
        put("<=", LEQ);
        put(">", GRE);
        put(">=", GEQ);
        put("==", EQL);
        put("!=", NEQ);
        put("=", ASSIGN);
        put(";", SEMICN);
        put(",", COMMA);
        put("(", LPARENT);
        put(")", RPARENT);
        put("[", LBRACK);
        put("]", RBRACK);
        put("{", LBRACE);
        put("}", RBRACE);
    }};
}
